package com.example.hcd.menuactivity;

import com.example.hcd.R;
import com.example.hcd.adapt.ViewUtils;
import com.example.hcd.datamanage.MenuManage;
import com.example.hcd.functionactivity.BaseActivity;
import com.example.hcd.menuactivity.UseCarMenuActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;

public class AdminstrteMneuActivity extends BaseActivity {
    private AdminstrteMneuActivity adminstrteMneuActivity;
    private ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.other_menu_view);
        mPageName = "AdminstrteMneuActivity";
        adminstrteMneuActivity = this;

        TextView title = (TextView) findViewById(R.id.title_content);
        title.setText(this.getString(R.string.adminstration_office));
        listView = (ListView) findViewById(R.id.list);
        findViewById(R.id.title_bar_btn_left).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {

                finish();
            }
        });

        ViewUtils view1 = new ViewUtils(this, R.layout.other_view_item);

        view1.setList(MenuManage.getInstence().getMainMenu(this, MenuManage.getInstence().menu1Id));
        listView.setAdapter(view1);

        listView.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position) {
                    case 0:
                        Intent intent = new Intent(adminstrteMneuActivity, ReimburseManageMenuActivity.class);
                        startActivity(intent);
                        break;

                    case 1: {
                        Intent intent1 = new Intent(adminstrteMneuActivity, PaymentManageMenuActivity.class);
                        startActivity(intent1);
                    }

                    break;

                    case 2:
                        Intent intent2 = new Intent(adminstrteMneuActivity, BorrowManageMenuActivity.class);
                        startActivity(intent2);
                        break;
                    case 3:
                        Intent intent3 = new Intent(adminstrteMneuActivity, PurchaseManageMenuActivity.class);
                        startActivity(intent3);
                        break;

                    case 4: {
                        Intent intent4 = new Intent(adminstrteMneuActivity, SealuseManageMenuActivity.class);
                        startActivity(intent4);
                    }
                    break;
                    case 5:
                        Intent intent5 = new Intent(adminstrteMneuActivity, NoticeManageMenuActivity.class);
                        startActivity(intent5);
                        break;
                    case 6:
                        Intent intent6 = new Intent(adminstrteMneuActivity, PersonalWorkAttendanceMenuActivity.class);
                        startActivity(intent6);
                        break;

                    case 7:
                        Intent intent7 = new Intent(adminstrteMneuActivity, UseCarMenuActivity.class);
                        startActivity(intent7);
                        break;

                    default:
                        break;
                }
            }
        });

    }

}
